{
 "nbformat": 4,
 "nbformat_minor": 0,
 "metadata": {
  "colab": {
   "provenance": [
    {
     "file_id": "1_hbTrNxeJE58LmHcG-ml-ODzuKeudW5A",
     "timestamp": 1716863325485
    }
   ],
   "gpuType": "T4",
   "authorship_tag": "ABX9TyPWKdwuA2bvI1xW3FQrkMOr"
  },
  "kernelspec": {
   "name": "python3",
   "display_name": "Python 3"
  },
  "language_info": {
   "name": "python"
  },
  "accelerator": "GPU"
 },
 "cells": [
  {
   "cell_type": "markdown",
   "source": [
    "##### Copyright 2024 Google LLC."
   ],
   "metadata": {
    "id": "N0WWINoe_H78"
   }
  },
  {
   "cell_type": "code",
   "source": [
    "# @title Licensed under the Apache License, Version 2.0 (the \"License\");\n",
    "# you may not use this file except in compliance with the License.\n",
    "# You may obtain a copy of the License at\n",
    "#\n",
    "# https://www.apache.org/licenses/LICENSE-2.0\n",
    "#\n",
    "# Unless required by applicable law or agreed to in writing, software\n",
    "# distributed under the License is distributed on an \"AS IS\" BASIS,\n",
    "# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n",
    "# See the License for the specific language governing permissions and\n",
    "# limitations under the License."
   ],
   "metadata": {
    "cellView": "form",
    "id": "KCbtuTFR_Qot"
   },
   "execution_count": null,
   "outputs": []
  },
  {
   "cell_type": "markdown",
   "source": [
    "# Gemma - Game Design Brainstorming\n",
    "\n",
    "This cookbook illustrates how you can employ the instruction-tuned model version of Gemma as a chatbot to aid in your game design process by fostering brainstorming sessions effectively.\n",
    "\n",
    "<table align=\"left\">\n",
    "  <td>\n",
    "    <a target=\"_blank\" href=\"https://colab.research.google.com/github/google-gemini/gemma-cookbook/blob/main/Gemma/Game_Design_Brainstorming.ipynb\"><img src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" />Run in Google Colab</a>\n",
    "  </td>\n",
    "</table>"
   ],
   "metadata": {
    "id": "H3LrD1zZ_T1v"
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "## Setup\n",
    "\n",
    "### Select the Colab runtime\n",
    "To complete this tutorial, you'll need to have a Colab runtime with sufficient resources to run the Gemma model. In this case, you can use a T4 GPU:\n",
    "\n",
    "1. In the upper-right of the Colab window, select **▾ (Additional connection options)**.\n",
    "2. Select **Change runtime type**.\n",
    "3. Under **Hardware accelerator**, select **T4 GPU**.\n",
    "\n",
    "\n",
    "### Gemma setup on Kaggle\n",
    "To complete this tutorial, you'll first need to complete the setup instructions at [Gemma setup](https://ai.google.dev/gemma/docs/setup). The Gemma setup instructions show you how to do the following:\n",
    "\n",
    "* Get access to Gemma on kaggle.com.\n",
    "* Select a Colab runtime with sufficient resources to run the Gemma 2B model.\n",
    "* Generate and configure a Kaggle username and API key.\n",
    "\n",
    "After you've completed the Gemma setup, move on to the next section, where you'll set environment variables for your Colab environment."
   ],
   "metadata": {
    "id": "00NyqqWcAXw1"
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "### Set environment variables\n",
    "\n",
    "Set environment variables for `KAGGLE_USERNAME` and `KAGGLE_KEY`."
   ],
   "metadata": {
    "id": "ufH54qq0A7aJ"
   }
  },
  {
   "cell_type": "code",
   "source": [
    "import os\n",
    "from google.colab import userdata\n",
    "\n",
    "# Note: `userdata.get` is a Colab API. If you're not using Colab, set the env\n",
    "# vars as appropriate for your system.\n",
    "os.environ[\"KAGGLE_USERNAME\"] = userdata.get(\"KAGGLE_USERNAME\")\n",
    "os.environ[\"KAGGLE_KEY\"] = userdata.get(\"KAGGLE_KEY\")"
   ],
   "metadata": {
    "id": "ybKQhkYrBNkv"
   },
   "execution_count": null,
   "outputs": []
  },
  {
   "cell_type": "markdown",
   "source": [
    "### Install dependencies\n",
    "\n",
    "Install Keras and KerasNLP."
   ],
   "metadata": {
    "id": "BLwEJIILBQ17"
   }
  },
  {
   "cell_type": "code",
   "source": [
    "# Install Keras 3 last. See https://keras.io/getting_started/ for more details.\n",
    "!pip install -q -U keras-nlp\n",
    "!pip install -q -U keras"
   ],
   "metadata": {
    "id": "VPurjYcxBTxl"
   },
   "execution_count": null,
   "outputs": []
  },
  {
   "cell_type": "markdown",
   "source": [
    "## Core Concept"
   ],
   "metadata": {
    "id": "QOj_rAJtkOtV"
   }
  },
  {
   "cell_type": "code",
   "source": [
    "# A super concise description of your game\n",
    "pitch = \"In the heart of a reimagined Joseon Dynasty, where steam-powered machines and clockwork contraptions reign supreme, embark on an epic adventure to unravel the mysteries of a forgotten past and shape the destiny of a nation on the brink of revolution.\""
   ],
   "metadata": {
    "id": "7Fzu_ah4kR9E"
   },
   "execution_count": null,
   "outputs": []
  },
  {
   "cell_type": "markdown",
   "source": [
    "## Load Model"
   ],
   "metadata": {
    "id": "cwjJp6YZj2jp"
   }
  },
  {
   "cell_type": "code",
   "source": [
    "import keras\n",
    "import keras_nlp\n",
    "\n",
    "# Run at half precision to fit in memory\n",
    "keras.config.set_floatx(\"bfloat16\")\n",
    "\n",
    "import textwrap\n",
    "from IPython.display import Markdown\n",
    "\n",
    "\n",
    "def to_markdown(text):\n",
    "    text = text.replace(\"•\", \"  *\")\n",
    "    return Markdown(textwrap.indent(text, \"> \", predicate=lambda _: True))\n",
    "\n",
    "\n",
    "gemma_lm = keras_nlp.models.GemmaCausalLM.from_preset(\"gemma_1.1_instruct_2b_en\")\n",
    "gemma_lm.compile(sampler=\"top_k\")\n",
    "\n",
    "\n",
    "class GemmaChat:\n",
    "\n",
    "    __START_TURN__ = \"<start_of_turn>\"\n",
    "    __END_TURN__ = \"<end_of_turn>\"\n",
    "\n",
    "    def __init__(self, model, system=\"\", history=None):\n",
    "        self.model = model\n",
    "        self.system = system\n",
    "        if not history:\n",
    "            self.history = []\n",
    "        else:\n",
    "            self.history = history\n",
    "\n",
    "    def format_message(self, message, prefix=\"\"):\n",
    "        return f\"{self.__START_TURN__}{prefix}\\n{message}{self.__END_TURN__}\\n\"\n",
    "\n",
    "    def add_to_history(self, message, prefix=\"\"):\n",
    "        formated_message = self.format_message(message, prefix)\n",
    "        self.history.append(formated_message)\n",
    "\n",
    "    def get_full_prompt(self):\n",
    "        prompt = \"\\n\".join([self.system + \"\\n\", *self.history])\n",
    "        return prompt\n",
    "\n",
    "    def send_message(self, message):\n",
    "        self.add_to_history(message, \"user\")\n",
    "        prompt = self.get_full_prompt()\n",
    "        response = self.model.generate(prompt, max_length=4096)\n",
    "        # print('--------------------response---------------------------')\n",
    "        # print(response)\n",
    "        # print('--------------------response---------------------------')\n",
    "        result = response.replace(prompt, \"\")\n",
    "        self.add_to_history(result, \"model\")\n",
    "        return result\n",
    "\n",
    "    def show_history(self):\n",
    "        for h in self.history:\n",
    "            print(h)\n",
    "\n",
    "\n",
    "chat = GemmaChat(gemma_lm)"
   ],
   "metadata": {
    "id": "9NQ431sej9Q6"
   },
   "execution_count": null,
   "outputs": []
  },
  {
   "cell_type": "markdown",
   "source": [
    "## Elaborate with the given core game concept"
   ],
   "metadata": {
    "id": "slvLngXKlIIh"
   }
  },
  {
   "cell_type": "code",
   "source": [
    "result = chat.send_message(\n",
    "    f\"Elaborate about this game with the given core concept below.\\n{pitch}\"\n",
    ")\n",
    "to_markdown(result)"
   ],
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 917
    },
    "id": "B49foWx2lQe0",
    "executionInfo": {
     "status": "ok",
     "timestamp": 1714021526192,
     "user_tz": -540,
     "elapsed": 44794,
     "user": {
      "displayName": "Ju-yeong Ji",
      "userId": "07739812480064137731"
     }
    },
    "outputId": "45ea0538-b8dd-4974-cc5d-78c6cca9a11d"
   },
   "execution_count": null,
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ],
      "text/markdown": "> **Core Concept:** Clockpunk fantasy meets historical intrigue in a meticulously crafted Joseon Dynasty setting.\n> \n> **Possible Gameplay Elements:**\n> - Unravel secrets of a lost empire using interactive historical documents.\n> - Craft and upgrade your own mechanical gadgets from a diverse array of components.\n> - Engage in political machinations and forge alliances with various factions.\n> - Solve intricate puzzles and navigate perilous landscapes with the aid of your mechanical contraptions.\n> \n> \n> **Additional Considerations:**\n> - The game should offer multiple storylines and endings, reflecting different player choices.\n> - Character customization and faction allegiances should play a significant role.\n> - A rich lore and detailed worldbuilding should be established to immerse players in the unique setting.\n> \n> **Target Audience:** Fans of historical fiction, clockpunk, puzzle-solving games, and strategy RPGs.\n> \n> \n> **Possible Title:** The Cogborn Emperor\n> \n> **Possible Setting:** Joseon Dynasty, reimagined with steam-powered technology and mechanical contraptions.\n> \n> **Possible Tone:** Intriguing, mysterious, and strategic.\n> \n> **Possible Gameplay Mechanics:**\n> - **Gadget Crafting:** Gather resources and assemble various mechanical devices from scratch.\n> - **Document Analysis:** Interpret historical records to uncover hidden secrets and clues.\n> - **Political Intrigue:** Negotiate with different factions and sway them towards your cause.\n> - **Puzzle-Solving:** Use your mechanical contraptions to solve environmental and narrative puzzles.\n> \n> **Additional Notes:**\n> - The game should feature a diverse cast of characters, each with their own unique motivations and abilities.\n> - The soundtrack should enhance the atmosphere and setting.\n> - The game should offer high replayability with multiple playthroughs and different outcomes.\n> \n> ## Potential Story Arcs:\n> \n> **1. The Forbidden Invention:** A clandestine inventor discovers a lost technology that threatens to unravel the established order.\n> \n> **2. The Forgotten Emperor:** A deposed emperor returns from exile to reclaim his throne and restore his lost glory.\n> \n> **3. The Shadow Conspiracy:** A shadowy cabal seeks to manipulate events from the shadows, leaving their motives unclear.\n> \n> ## Potential Endings:\n> \n> **1. The Peaceful Revolution:** The people rise up and overthrow the corrupt ruling class.\n> \n> **2. The Imperial Restoration:** The current emperor maintains control, but agrees to reforms.\n> \n> **3. The Mechanical Age:** The nation embraces technological advancement, transforming itself into a powerful empire."
     },
     "metadata": {},
     "execution_count": 3
    }
   ]
  },
  {
   "cell_type": "markdown",
   "source": [
    "## Main Characters"
   ],
   "metadata": {
    "id": "rePDwH-kesBv"
   }
  },
  {
   "cell_type": "code",
   "source": [
    "result = chat.send_message(\"Design main characters.\")\n",
    "to_markdown(result)"
   ],
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 226
    },
    "id": "5SWcXllmm-GW",
    "executionInfo": {
     "status": "ok",
     "timestamp": 1714021530177,
     "user_tz": -540,
     "elapsed": 3988,
     "user": {
      "displayName": "Ju-yeong Ji",
      "userId": "07739812480064137731"
     }
    },
    "outputId": "17295e70-c2fb-438d-f7d5-dd4be5d993cb"
   },
   "execution_count": null,
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ],
      "text/markdown": "> ## Main Character Concepts:\n> \n> **1. Park Su-hyun:** A cunning strategist and inventor, haunted by the loss of his family in the political upheaval.\n> \n> **2. Seo-yeon:** A skilled engineer with a passion for uncovering lost technology, driven by a thirst for knowledge.\n> \n> **3. Han-joon:** A ruthless politician, manipulating events from the shadows for his own power.\n> \n> **4. Jeong-ah:** A master spy, skilled in gathering information and uncovering secrets.\n> \n> **5. Yi-seo:** A cunning strategist and former general, seeking redemption for past mistakes."
     },
     "metadata": {},
     "execution_count": 4
    }
   ]
  },
  {
   "cell_type": "markdown",
   "source": [
    "## Villain Characters"
   ],
   "metadata": {
    "id": "T6nTOt5reta2"
   }
  },
  {
   "cell_type": "code",
   "source": [
    "result = chat.send_message(\"Design villain characters.\")\n",
    "to_markdown(result)"
   ],
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 261
    },
    "id": "eSeNGJZKWwM0",
    "executionInfo": {
     "status": "ok",
     "timestamp": 1714021534447,
     "user_tz": -540,
     "elapsed": 4272,
     "user": {
      "displayName": "Ju-yeong Ji",
      "userId": "07739812480064137731"
     }
    },
    "outputId": "57301861-fedf-49a4-b9cd-aaf629ec5038"
   },
   "execution_count": null,
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ],
      "text/markdown": "> ## Villain Concepts:\n> \n> **1. The Whispering Shadow:** A mysterious entity manipulating events from the shadows, seeking to plunge the nation into eternal darkness.\n> \n> **2. The Iron Chancellor:** A power-hungry politician who seeks to maintain his control at all costs.\n> \n> **3. The Clocksmith:** A twisted inventor who has fused his consciousness with a mechanical clockwork, driven by a desire to reshape reality.\n> \n> **4. The Aether Weaver:** A vengeful alchemist who seeks to consume the nation in an ethereal energy storm.\n> \n> **5. The Serpent Guild:** A clandestine organization of assassins, driven by an insatiable thirst for power."
     },
     "metadata": {},
     "execution_count": 5
    }
   ]
  },
  {
   "cell_type": "markdown",
   "source": [
    "## Main Story"
   ],
   "metadata": {
    "id": "Bxx6ftEve5C1"
   }
  },
  {
   "cell_type": "code",
   "source": [
    "result = chat.send_message(\n",
    "    \"Write the main story of this game with an introduction, development, turn, and conclusion.\"\n",
    ")\n",
    "to_markdown(result)"
   ],
   "metadata": {
    "id": "tG6HM-yJnJoF",
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 609
    },
    "executionInfo": {
     "status": "ok",
     "timestamp": 1714021546514,
     "user_tz": -540,
     "elapsed": 12070,
     "user": {
      "displayName": "Ju-yeong Ji",
      "userId": "07739812480064137731"
     }
    },
    "outputId": "e3f5a87e-7c4f-4cc3-8422-da7d7f29fc7a"
   },
   "execution_count": null,
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ],
      "text/markdown": "> ## The Cogborn Emperor: A Tale of Revolution and Steam\n> \n> **Introduction:**\n> \n> Within the reimagined Joseon Dynasty, a whisper of change hangs in the air. Steam-powered machines and intricate clockwork devices have become the hallmarks of a nation on the brink of transformation. But beneath the glittering advancements lie shadows, secrets, and a yearning for a forgotten past.\n> \n> You are an individual of remarkable intellect and determination, bound by destiny to unravel the mysteries of a lost empire. In the heart of this technological revolution, you find yourself entangled in a web of political intrigue and ancient prophecies.\n> \n> **Development:**\n> \n> Your journey begins in a clandestine meeting, where you are approached by a shadowy figure who reveals a devastating truth: a powerful entity seeks to manipulate events from the shadows, threatening the balance of power in the nation. Armed with your wit, your mechanical ingenuity, and the loyalty of your trusted allies, you must uncover the secrets of the past to uncover the identity of the villain and their motives.\n> \n> Through your travels, you encounter diverse factions, each with their own political agendas. You must navigate political negotiations, forge alliances, and make strategic decisions that will shape the fate of the nation.\n> \n> **Turn:**\n> \n> As you delve deeper into the mystery, you discover your own personal connection to the conspiracy. The lines between reality and illusion blur as the fate of the empire hangs in the balance. You must make difficult choices, sacrificing relationships and risking your own life for the greater good.\n> \n> **Conclusion:**\n> \n> Your ultimate challenge awaits in the heart of the conspiracy, where you must face the mastermind behind the shadows. With your skills and the power of your allies, you must uncover the villain's true identity reveal their motivations and bring them to justice.\n> \n> The fate of the nation rests in your hands. Will you usher in a new era of peace and enlightenment, or will you sacrifice some ideals for the greater good? The choice is yours."
     },
     "metadata": {},
     "execution_count": 6
    }
   ]
  },
  {
   "cell_type": "markdown",
   "source": [
    "## Show the chat history"
   ],
   "metadata": {
    "id": "CNAwQXG2Tbee"
   }
  },
  {
   "cell_type": "code",
   "source": [
    "chat.show_history()"
   ],
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "4qW12hdKTfc2",
    "executionInfo": {
     "status": "ok",
     "timestamp": 1714021546515,
     "user_tz": -540,
     "elapsed": 5,
     "user": {
      "displayName": "Ju-yeong Ji",
      "userId": "07739812480064137731"
     }
    },
    "outputId": "1e617e0f-eeed-4ced-e718-71de30fee26b"
   },
   "execution_count": null,
   "outputs": [
    {
     "output_type": "stream",
     "name": "stdout",
     "text": [
      "<start_of_turn>user\n",
      "Elaborate about this game with the given core concept below.\n",
      "In the heart of a reimagined Joseon Dynasty, where steam-powered machines and clockwork contraptions reign supreme, embark on an epic adventure to unravel the mysteries of a forgotten past and shape the destiny of a nation on the brink of revolution.<end_of_turn>\n",
      "\n",
      "<start_of_turn>model\n",
      "**Core Concept:** Clockpunk fantasy meets historical intrigue in a meticulously crafted Joseon Dynasty setting.\n",
      "\n",
      "**Possible Gameplay Elements:**\n",
      "- Unravel secrets of a lost empire using interactive historical documents.\n",
      "- Craft and upgrade your own mechanical gadgets from a diverse array of components.\n",
      "- Engage in political machinations and forge alliances with various factions.\n",
      "- Solve intricate puzzles and navigate perilous landscapes with the aid of your mechanical contraptions.\n",
      "\n",
      "\n",
      "**Additional Considerations:**\n",
      "- The game should offer multiple storylines and endings, reflecting different player choices.\n",
      "- Character customization and faction allegiances should play a significant role.\n",
      "- A rich lore and detailed worldbuilding should be established to immerse players in the unique setting.\n",
      "\n",
      "**Target Audience:** Fans of historical fiction, clockpunk, puzzle-solving games, and strategy RPGs.\n",
      "\n",
      "\n",
      "**Possible Title:** The Cogborn Emperor\n",
      "\n",
      "**Possible Setting:** Joseon Dynasty, reimagined with steam-powered technology and mechanical contraptions.\n",
      "\n",
      "**Possible Tone:** Intriguing, mysterious, and strategic.\n",
      "\n",
      "**Possible Gameplay Mechanics:**\n",
      "- **Gadget Crafting:** Gather resources and assemble various mechanical devices from scratch.\n",
      "- **Document Analysis:** Interpret historical records to uncover hidden secrets and clues.\n",
      "- **Political Intrigue:** Negotiate with different factions and sway them towards your cause.\n",
      "- **Puzzle-Solving:** Use your mechanical contraptions to solve environmental and narrative puzzles.\n",
      "\n",
      "**Additional Notes:**\n",
      "- The game should feature a diverse cast of characters, each with their own unique motivations and abilities.\n",
      "- The soundtrack should enhance the atmosphere and setting.\n",
      "- The game should offer high replayability with multiple playthroughs and different outcomes.\n",
      "\n",
      "## Potential Story Arcs:\n",
      "\n",
      "**1. The Forbidden Invention:** A clandestine inventor discovers a lost technology that threatens to unravel the established order.\n",
      "\n",
      "**2. The Forgotten Emperor:** A deposed emperor returns from exile to reclaim his throne and restore his lost glory.\n",
      "\n",
      "**3. The Shadow Conspiracy:** A shadowy cabal seeks to manipulate events from the shadows, leaving their motives unclear.\n",
      "\n",
      "## Potential Endings:\n",
      "\n",
      "**1. The Peaceful Revolution:** The people rise up and overthrow the corrupt ruling class.\n",
      "\n",
      "**2. The Imperial Restoration:** The current emperor maintains control, but agrees to reforms.\n",
      "\n",
      "**3. The Mechanical Age:** The nation embraces technological advancement, transforming itself into a powerful empire.<end_of_turn>\n",
      "\n",
      "<start_of_turn>user\n",
      "Design main characters.<end_of_turn>\n",
      "\n",
      "<start_of_turn>model\n",
      "## Main Character Concepts:\n",
      "\n",
      "**1. Park Su-hyun:** A cunning strategist and inventor, haunted by the loss of his family in the political upheaval.\n",
      "\n",
      "**2. Seo-yeon:** A skilled engineer with a passion for uncovering lost technology, driven by a thirst for knowledge.\n",
      "\n",
      "**3. Han-joon:** A ruthless politician, manipulating events from the shadows for his own power.\n",
      "\n",
      "**4. Jeong-ah:** A master spy, skilled in gathering information and uncovering secrets.\n",
      "\n",
      "**5. Yi-seo:** A cunning strategist and former general, seeking redemption for past mistakes.<end_of_turn>\n",
      "\n",
      "<start_of_turn>user\n",
      "Design villain characters.<end_of_turn>\n",
      "\n",
      "<start_of_turn>model\n",
      "## Villain Concepts:\n",
      "\n",
      "**1. The Whispering Shadow:** A mysterious entity manipulating events from the shadows, seeking to plunge the nation into eternal darkness.\n",
      "\n",
      "**2. The Iron Chancellor:** A power-hungry politician who seeks to maintain his control at all costs.\n",
      "\n",
      "**3. The Clocksmith:** A twisted inventor who has fused his consciousness with a mechanical clockwork, driven by a desire to reshape reality.\n",
      "\n",
      "**4. The Aether Weaver:** A vengeful alchemist who seeks to consume the nation in an ethereal energy storm.\n",
      "\n",
      "**5. The Serpent Guild:** A clandestine organization of assassins, driven by an insatiable thirst for power.<end_of_turn>\n",
      "\n",
      "<start_of_turn>user\n",
      "Write the main story of this game with an introduction, development, turn, and conclusion.<end_of_turn>\n",
      "\n",
      "<start_of_turn>model\n",
      "## The Cogborn Emperor: A Tale of Revolution and Steam\n",
      "\n",
      "**Introduction:**\n",
      "\n",
      "Within the reimagined Joseon Dynasty, a whisper of change hangs in the air. Steam-powered machines and intricate clockwork devices have become the hallmarks of a nation on the brink of transformation. But beneath the glittering advancements lie shadows, secrets, and a yearning for a forgotten past.\n",
      "\n",
      "You are an individual of remarkable intellect and determination, bound by destiny to unravel the mysteries of a lost empire. In the heart of this technological revolution, you find yourself entangled in a web of political intrigue and ancient prophecies.\n",
      "\n",
      "**Development:**\n",
      "\n",
      "Your journey begins in a clandestine meeting, where you are approached by a shadowy figure who reveals a devastating truth: a powerful entity seeks to manipulate events from the shadows, threatening the balance of power in the nation. Armed with your wit, your mechanical ingenuity, and the loyalty of your trusted allies, you must uncover the secrets of the past to uncover the identity of the villain and their motives.\n",
      "\n",
      "Through your travels, you encounter diverse factions, each with their own political agendas. You must navigate political negotiations, forge alliances, and make strategic decisions that will shape the fate of the nation.\n",
      "\n",
      "**Turn:**\n",
      "\n",
      "As you delve deeper into the mystery, you discover your own personal connection to the conspiracy. The lines between reality and illusion blur as the fate of the empire hangs in the balance. You must make difficult choices, sacrificing relationships and risking your own life for the greater good.\n",
      "\n",
      "**Conclusion:**\n",
      "\n",
      "Your ultimate challenge awaits in the heart of the conspiracy, where you must face the mastermind behind the shadows. With your skills and the power of your allies, you must uncover the villain's true identity reveal their motivations and bring them to justice.\n",
      "\n",
      "The fate of the nation rests in your hands. Will you usher in a new era of peace and enlightenment, or will you sacrifice some ideals for the greater good? The choice is yours.<end_of_turn>\n",
      "\n"
     ]
    }
   ]
  },
  {
   "cell_type": "markdown",
   "source": [
    "## Clear History"
   ],
   "metadata": {
    "id": "YYvLo-OLkj0g"
   }
  },
  {
   "cell_type": "code",
   "source": [
    "chat.history.clear()"
   ],
   "metadata": {
    "id": "ngWPjllXkljM"
   },
   "execution_count": null,
   "outputs": []
  },
  {
   "cell_type": "markdown",
   "source": [
    "## Expansion Idea"
   ],
   "metadata": {
    "id": "O0fZNg2Eykbq"
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "### Marketing Phrase"
   ],
   "metadata": {
    "id": "QP1zppatyosv"
   }
  },
  {
   "cell_type": "code",
   "source": [
    "chat.history.clear()\n",
    "pitch = \"A new steam-powered toothbrush\"\n",
    "result = chat.send_message(\n",
    "    f\"Generate a marketing phrase for the new product below.\\n{pitch}\"\n",
    ")\n",
    "to_markdown(result)"
   ],
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 486
    },
    "id": "H2PcNCO_ytEP",
    "executionInfo": {
     "status": "ok",
     "timestamp": 1714024187704,
     "user_tz": -540,
     "elapsed": 7681,
     "user": {
      "displayName": "Ju-yeong Ji",
      "userId": "07739812480064137731"
     }
    },
    "outputId": "05cd8931-a803-4956-aedd-e6a08e7c4e87"
   },
   "execution_count": null,
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ],
      "text/markdown": "> * Cleans teeth with precision and efficiency\n> * Uses natural steam power for a deeper clean\n> * Gentle on teeth and gums\n> \n> **Marketing Phrase Options:**\n> \n> * **Steam to a Brighter Smile**\n> * **The Power of Steam for Superior Oral Care**\n> * **Experience a Clean Beyond Compare**\n> * **Gentle Steam, Powerful Clean**\n> * **Steam-Powered Precision for Optimal Oral Health**\n> \n> \n> **Which marketing phrase would be most effective to highlight the unique benefits of the steam-powered toothbrush?**\n> \n> I believe **\"Steam-Powered Precision for Optimal Oral Health\"** is the most effective marketing phrase because:\n> \n> * **Clearly conveys the technology:** \"Steam-Powered\" instantly communicates the unique operating mechanism of the toothbrush.\n> * **Highlights precision and efficiency:** \"Precision\" suggests careful cleaning, while \"efficiency\" implies a thorough clean in less time.\n> * **Focuses on oral health:** The phrase emphasizes the toothbrush's ultimate goal of optimal oral health. \n> \n> **Additionally, this phrase:**\n> \n> * Uses strong action-oriented language.\n> * Appeals to both practical and aesthetic concerns.\n> * Is concise and memorable."
     },
     "metadata": {},
     "execution_count": 3
    }
   ]
  },
  {
   "cell_type": "markdown",
   "source": [
    "### Florist Ideas"
   ],
   "metadata": {
    "id": "oJbiCXoszJVN"
   }
  },
  {
   "cell_type": "code",
   "source": [
    "chat.history.clear()\n",
    "pitch = \"Universe and shooting stars\"\n",
    "result = chat.send_message(\n",
    "    f\"Generate a florist idea inspired by the concept below, along with suggestions for suitable flowers.\\n{pitch}\"\n",
    ")\n",
    "to_markdown(result)"
   ],
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 324
    },
    "id": "BKXXigmxzZp_",
    "executionInfo": {
     "status": "ok",
     "timestamp": 1714024227949,
     "user_tz": -540,
     "elapsed": 5935,
     "user": {
      "displayName": "Ju-yeong Ji",
      "userId": "07739812480064137731"
     }
    },
    "outputId": "1ef469e3-ee23-4ade-b80f-597c8270a108"
   },
   "execution_count": null,
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ],
      "text/markdown": "> \n> \n> **Florist Idea:**\n> \n> **\"Cosmic Embrace\"**\n> \n> **Concept:** A breathtaking arrangement inspired by the vastness of the cosmos, featuring ethereal flowers representing celestial bodies. \n> \n> \n> **Suitable Flowers:**\n> \n> - **Cosmos:** Represent the delicate balance of energy in the universe.\n> - **Stargazer lilies:** Symbolize reaching for the stars and boundless potential.\n> - **Aster:** Known for their star-shaped blooms, representing shooting stars.\n> - **Blue hydrangea:** Suggests the deep mysteries of the cosmos.\n> - **Lavender:** Represents growth and transformation, echoing the evolution of the universe.\n> \n> **Additional Elements:**\n> \n> - Silver or mirrored glass vase to evoke the reflective surface of space.\n> - Silver leaf foliage to create a shimmering, cosmic effect.\n> - Dried flower petals resembling cosmic dust, adding a touch of etherealness."
     },
     "metadata": {},
     "execution_count": 4
    }
   ]
  },
  {
   "cell_type": "markdown",
   "source": [
    "### Food Recipe"
   ],
   "metadata": {
    "id": "jsNqqjZwziHi"
   }
  },
  {
   "cell_type": "code",
   "source": [
    "chat.history.clear()\n",
    "pitch = \"Cyberpunk Kraken\"\n",
    "result = chat.send_message(\n",
    "    f\"Generate a cooking recipe with the concept below.\\n{pitch}\"\n",
    ")\n",
    "to_markdown(result)"
   ],
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 590
    },
    "id": "FbXyDjkfznJ_",
    "executionInfo": {
     "status": "ok",
     "timestamp": 1714024282787,
     "user_tz": -540,
     "elapsed": 10833,
     "user": {
      "displayName": "Ju-yeong Ji",
      "userId": "07739812480064137731"
     }
    },
    "outputId": "b44fbe05-d727-40e9-ab4f-cba8b867b3ea"
   },
   "execution_count": null,
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ],
      "text/markdown": "> The Kraken is a creature of the deep sea that is often depicted as a giant octopus. In this recipe, we will give the Kraken a cybernetic upgrade with the addition of some high-tech ingredients like LED lights and microchips. \n> \n> **Ingredients:**\n> \n> - 2 pounds of fresh octopus tentacles\n> - 1/2 cup of soy sauce\n> - 1/4 cup of sake or rice wine\n> - 1 tablespoon of cornstarch\n> - 2 tablespoons of vegetable oil\n> - 1/4 cup of LED lights\n> - 1 microchip (optional)\n> \n> **Instructions:**\n> \n> 1. **Prepare the Kraken:** Cut the octopus tentacles into bite-sized pieces. In a bowl, combine the octopus pieces with the soy sauce, sake, cornstarch, and vegetable oil. Toss to coat.\n> \n> \n> 2. **Cyberize the Kraken:** Arrange the octopus pieces on a baking sheet and sprinkle the LED lights over the top. Bake for 10-15 minutes or until the LED lights are glowing and the octopus is cooked through.\n> \n> \n> 3. **Microchip enhancement (Optional):** If desired, insert a microchip into one of the octopus pieces before baking. This will give the Kraken a unique ability to glow in the dark.\n> \n> \n> 4. **Serve and enjoy:** Serve the cyberpunk Kraken immediately with your favorite dipping sauce.\n> \n> **Tips:**\n> \n> - For a more realistic effect, serve the cyberpunk Kraken with a side of glowing seaweed or other marine plants.\n> - If you're feeling adventurous, add some chopped chili peppers to the marinade for a spicy kick. \n> - Serve with a side of crusty bread to soak up the delicious sauce."
     },
     "metadata": {},
     "execution_count": 5
    }
   ]
  }
 ]
}